#include <stdio.h>

int main()
{
    char *getMemSet(int num)
    {
        char *p = NULL;
        p = (char *)malloc(100 * sizeof(char));
        return p;
    }

    int freeMemSet(char *p)
    {
        if(p == NULL)
        {
            return -1;
        }
        if(p != NULL)
        {
            free(p);
            p = NULL;
        }
        return 0;
    }

    char *p = NULL;
    p = getMemSet(100);

    freeMemSet(p);
    freeMemSet(p);
    freeMemSet(p);// 宕
    // 在不同的编译器下不报错,但是也要避免这种情况.
    char *p1 = NULL;
    p1 = (char *)malloc(100 * sizeof(char));
    p1 = NULL;
    free(p1);
    free(p1);

    getchar();
    printf("Hello World!\n");
    return 0;
}
